package com.liaogui.设计模式.观察者模式;

import java.util.Vector;

/**
 * @author liaogui
 * @date 2025/3/28 10:36
 */
public abstract class Subject {
    private Vector<Observer> obs = new Vector();

    public void add(Observer observer) {
        obs.add(observer);
    }

    public void remove(Observer observer) {
        obs.remove(observer);
    }

    protected void notifyObservers() {
        for (Observer observer : obs) {
            observer.update();
        }
    }

    public abstract void doSomething();
}
